//
//  UserCommentsCell.m
//  ImGuider
//
//  Created by 王鹏宇 on 2017/8/30.
//  Copyright © 2017年 AudioCtrip. All rights reserved.
//

#import "UserCommentsCell.h"
#import "NSDate+Additions.h"

@implementation UserCommentsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.userIconImageView.layer.cornerRadius = 16;
    self.userIconImageView.clipsToBounds = YES;
    self.userIconImageView.layer.borderWidth = 0.5f;
    self.userIconImageView.layer.borderColor = kContentColor.CGColor;
    self.userNameLabel.textColor = kSubitleColor;
    self.dateLabel.textColor = kContentColor;
    self.contentLabel.textColor = kContentColor;
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}


- (void)configDataWith:(Comment *)model {
    
    [self.userIconImageView setImageURL:[NSURL URLWithString:model.headimg] placeholderImage:[UIImage imageNamed:@"default"]];
    
    self.userNameLabel.text = model.realname;
    
    
//    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
//    //设定时间格式,这里可以设置成自己需要的格式
//    [dateFormatter setDateFormat:@"yyyy-MM-dd"];
//    //用[NSDate date]可以获取系统当前时间
//    NSString *currentDateStr = [dateFormatter stringFromDate:model.time];
    self.dateLabel.text = [model.time stringWithFormat:@"yyyy-MM-dd"];
    
    IGLog(@"%@",model.time);
    self.contentLabel.text = model.comment;
    
    [self.starView setScore:model.score.floatValue / 10.0];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
